<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="dashboard/header :: header"></head>
<body>
	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<!-- /.col-->
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">

								<form class="form-horizontal" id="addForm">
								
									<input type="hidden" name="formToken" th:value="${session.formToken}" />
									<input type="hidden" name="id" th:value="${bean.id}" />
								
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">所属应用</label>
										<div class="col-md-9">
											<input class="form-control" id="text-input" type="text"  th:value="${bean.applicationId}" onclick="showApplication()" name="applicationIdLabel" readonly="readonly" style="cursor: pointer" placeholder="所属应用">
											<input type="hidden" th:value="${bean.applicationId}" name="applicationId"  />
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">代码名称</label>
										<div class="col-md-9">
											<input class="form-control" id="text-input" th:value="${bean.codeName}" type="text" name="codeName" placeholder="代码名称">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">代码值</label>
										<div class="col-md-9">
											<input class="form-control" id="email-input" type="text" th:value="${bean.codeValue}"  name="codeValue" placeholder="代码值">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">代码类型</label>
										<div class="col-md-9">
											<select class="form-control" id="codeTypeValue" name="codeTypeValue">
												<option th:each="item:${codeTypes}" th:value="${item.codeTypeValue}" th:text="${item.codeTypeName}" selected></option>
											</select>
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">使用状态</label>
										<div class="col-md-9">
											<page:dict type="has_status" th:attr="value=${bean.hasStatus}" th:value="${bean.hasStatus}" name="hasStatus" />
										</div>
									</div>
								</form>

							</div>
							
						</div>
					</div>
				</div>
			</div>
		</div>

	</div>
	
	<footer th:replace="dashboard/footer :: footer"></footer>
	<script type="text/javascript" th:src="@{/resources/js/project.js}"></script>
		
	<script type="text/javascript">
	
		$(function(){
			$("#addForm").validate({
				ignore: [],  
				rules: {
					applicationId: "required",
					codeName: "required",
					codeValue: "required" ,
					codeTypeValue: "required"
				}
			});
		}) ;	
		
		function submitHandler() {
			var result = $.validate.form("addForm");
			if(result){
				$.operate.save(ctx+"portal/ucenter/dictionary/update" , $('#addForm').serialize());
			}
	    }

	</script>
	
</body>
</html>
